#pragma once

#include <QObject>
#include <QWidget>
#include <QMenu>
#include <QDockWidget>
#include <QTabWidget>
#include <QList>
#include "Terminal.h"

class TerminalPlugin : public QObject
{
	Q_OBJECT

public:
	TerminalPlugin(QWidget* notepad, QMenu* menu, const QString& pluginModulePath, QObject *parent = nullptr);
	~TerminalPlugin();

private:

	bool loadConfig(const QString& pluginFilePath, QList<Terminal*>& terminals);
	QString GetPluginDir(const QString& pluginModulePath);

private slots:
	void onMenuItemClick();
	void onDockLocationChanged(Qt::DockWidgetArea area);
	void onTabCloseRequested(int index);

private:
	QWidget* m_notepadWidget;
	QMenu* m_menu;
	QString m_pluginModulePath;
	QList<Terminal*> m_terminalList;
	QDockWidget* m_dockWidget;
	QWidget* m_dockTitleBarWidget;
	QWidget* m_dockEmptyTitleBarWidget;
	QTabWidget* m_tabWidget;
};
